package com.goldstone.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "COLOR")
public class Color extends AuditableEntity{
	private String name;
	private String cnName;
	private String descs;
	private List<Attachment> pics = new ArrayList<Attachment>();
	
	public Color() { }
	
	public Color(String name) {
		this.name = name; 
	}
	@Column(nullable = true)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescs() {
		return descs;
	}
	public void setDescs(String descs) {
		this.descs = descs;
	}

	public String getCnName() {
		return cnName;
	}

	public void setCnName(String cnName) {
		this.cnName = cnName;
	}

	@OneToMany
	@JoinTable(
		name = "COLOR_IMAGES",
		joinColumns = @JoinColumn(name = "color_id"),
		inverseJoinColumns = @JoinColumn( name = "atta_id") 
	)
	public List<Attachment> getPics() {
		return pics;
	}

	public void setPics(List<Attachment> pics) {
		this.pics = pics;
	}
}
